﻿package com.guavestudios.fnfo.plugins {
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	
	/**
	 * ...
	 * @author maze | ppmcity.com
	 */
	public class BasicButtonBarButton extends Sprite{
		private var captionText:TextField;
		private var _caption:String;
		private var _event:String;
		
		
		public function BasicButtonBarButton() {
			super();
			captionText = new TextField();
			captionText.autoSize = TextFieldAutoSize.LEFT;
			addChild(captionText);
			
			mouseChildren = false;
			buttonMode = true;
		}
		
		public function init(caption:String, event:String):void {
			this.caption = caption;
			_event = event;
		}
		
		public function get event():String { return _event; }
		public function set event(value:String):void {
			_event = value;
		}
		
		public function get caption():String { return _caption; }
		public function set caption(value:String):void {
			_caption = value;
			captionText.text = value;
			
			draw();
		}
		
		protected function draw():void {
			this.graphics.clear();
			this.graphics.lineStyle(1, 0x008080);
			this.graphics.beginFill(0x00A4A4);
			this.graphics.drawRect(0, 0, captionText.width, captionText.height);
			this.graphics.endFill();
		}
		
	}

}